<template>
  <m-page>
    <!-- 本期应还页 -->
    <m-header title="本期应还"></m-header>
    <div class="setPwd">
      <ynet-input-item
        ref="input3"
        title="交易密码"
        placeholder="请输入交易密码"
        is-amount
        :maxlength='6'
        v-model="data.pwd"
        is-virtual-keyboard
        virtual-keyboard-vm="myNumberKeyBoard"
        @change="inputchange()"
      ></ynet-input-item>
      <!-- 确认密码 -->
      <ynet-input-item
        ref="input4"
        title="确认密码"
        :maxlength='6'
        placeholder="请再输入交易密码"
        is-amount
        v-model="data.pwd_checked"
        is-virtual-keyboard
        virtual-keyboard-vm="myKeyBoard"
        @change="inputchange()"
      ></ynet-input-item>
    </div>
    <ynet-button type="primary" @click="submit()" v-if="isSubmit == '1'">提交</ynet-button>
    <ynet-button type="disabled" @click="checked()" v-if="isSubmit == '0'">提交</ynet-button>
    <ynet-number-keyboard type="simple" ref="myNumberKeyBoard"></ynet-number-keyboard>
    <ynet-number-keyboard type="simple" ref="myKeyBoard"></ynet-number-keyboard>
  </m-page>
</template>

<script>
import { InputItem, NumberKeyboard, Button, MessageCode } from "ynet-mobile";
export default {
  components: {
    [Button.name]: Button,
    [InputItem.name]: InputItem,
    [MessageCode.name]: MessageCode,
    [NumberKeyboard.name]: NumberKeyboard
  },
  data() {
    return {
      data: {
        pwd: "",
        pwd_checked: ""
      },
      isSubmit: "0" //提交按钮是否可用  0 输入框值为空则不可用按钮  1 按钮可用
    };
  },
  created() {},
  mounted() {},
  methods: {
     //页面跳转
    goto(item, params) {
      let url = `smallbusinessloan/rong_yi_tong_card/${item}`
      app.api.pushWindow( url ,params )
    },
     //输入框改变事件  输入值则提交按钮可用
    inputchange() {
      if ((this.data.pwd && this.data.pwd_checked) !== "") {
        this.isSubmit = "1";
      } else {
        this.isSubmit = "0";
      }
    },
    // 提交按钮
    submit() {
      if (this.data.pwd !== this.data.pwd_checked) {
        //两次输入的值一致 则出现提示
        app.api.showToast("两次密码不匹配，请重新输入！");
      } else if (this.data.pwd == this.data.pwd_checked) {
        
        this.goto("home_activation_result.html");
      }
    },
  },
  watch: {},
  computed: {}
};
</script>

<style lang="scss" scoped>
@import "./index.scss";
</style>

